/*
 * lab1_3.cpp
 *
 *  Created on: 2011-2-23
 *      Author: Aeolus
 */

/*
 * test3.cpp
 *
 *  Created on: 2011-2-23
 *      Author: Aeolus
 */
#include<iostream>
#include<string>
#include<vector>
#include "ChooseMainMember.cpp"
#include "FileProcessor.cpp"
using namespace std;
template<class Type>
vector<Type> getRequireData(vector<Type> &data);
int main()
{
	const string infile_name = "input.txt";
    const string outfile_name = "output.txt";
	vector<int> data;
	FileProcessor fp;
	GetMainMember gmm;
    fp.getdata(infile_name,data);//�õ����

    data = getRequireData(data);
    string x = gmm.getMainMember(data);//ȡ�õ�search_k_smallС����
    fp.output_data(outfile_name,x);//��ȡ�õ���������ļ���
	return 0;
}
template<class Type>
vector<Type> getRequireData(vector<Type> &data)
{
	int size = data[0];
	vector<Type> object_data(size);
	for(typename vector<Type>::size_type i=1; i!=data.size() && i!= size+1 ;i++)
	{
		object_data[i-1] = data[i];
	}
	return object_data;
}

